This patch adds the ability to view the devtree from the Xen console.
Signed-off-by: Jimi Xenidis <jimix@watson.ibm.com>
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
--HG--
extra : transplant_source : %CCE%28-%AF%3D%24/%DC%F6%E8X%C0%B1%8B%7F%10%86%A3%18
if (ofd_size(oft) > oft_sz)
of_panic("Could not fit all devtree fixups\n");
- ofd_walk(oft, OFD_ROOT, /* add_hype_props */ NULL, 2);
+ ofd_walk(oft, __func__, OFD_ROOT, /* add_hype_props */ NULL, 2);
mod->mod_start = (ulong)oft;
mod->mod_end = mod->mod_start + oft_sz;
extern void ofd_io_close(void *mem, ofdn_t n);
-typedef void (*walk_fn)(void *m, ofdn_t p, int arg);
-extern void ofd_dump_props(void *m, ofdn_t p, int dump);
+typedef void (*walk_fn)(void *m, const char *pre, ofdn_t p, int arg);
+extern void ofd_dump_props(void *m, const char *pre, ofdn_t p, int dump);
-extern void ofd_walk(void *m, ofdn_t p, walk_fn fn, int arg);
+extern void ofd_walk(void *m, const char *pre, ofdn_t p, walk_fn fn, int arg);
/* Recursively look up #address_cells and #size_cells properties */
#endif
}
-void ofd_dump_props(void *mem, ofdn_t n, int dump)
+void ofd_dump_props(void *mem, const char *pre, ofdn_t n, int dump)
{
ofdn_t p;
char name[128];
}
if (dump & OFD_DUMP_NAMES) {
- printk("of_walk: %s: phandle 0x%x\n", path, n);
+ printk("%s: %s: phandle 0x%x\n", pre, path, n);
}
p = ofd_nextprop(mem, n, NULL, name);
}
if ( dump & OFD_DUMP_VALUES ) {
- ofd_prop_print("of_walk", path, name, prop, sz);
+ ofd_prop_print(pre, path, name, prop, sz);
}
p = ofd_nextprop(mem, n, name, name);
}
}
-void ofd_walk(void *m, ofdn_t p, walk_fn fn, int arg)
+void ofd_walk(void *m, const char *pre, ofdn_t p, walk_fn fn, int arg)
{
ofdn_t n;
if ( fn != NULL ) {
- (*fn)(m, p, arg);
+ (*fn)(m, pre, p, arg);
}
/* child */
n = ofd_node_child(m, p);
if ( n != 0 ) {
- ofd_walk(m, n, fn, arg);
+ ofd_walk(m, pre, n, fn, arg);
}
/* peer */
n = ofd_node_peer(m, p);
if ( n != 0 ) {
- ofd_walk(m, n, fn, arg);
+ ofd_walk(m, pre, n, fn, arg);
}
}
#ifdef DEBUG
- ofd_walk(m, OFD_ROOT, ofd_dump_props, OFD_DUMP_ALL);
+ ofd_walk(m, __func__, OFD_ROOT, ofd_dump_props, OFD_DUMP_ALL);
#endif
return 1;
}
console_end_sync();
}
-static void hw_probe_attn(unsigned char key, struct cpu_user_regs *regs)
+static void key_hw_probe_attn(unsigned char key)
{
__attn();
}
+static void key_ofdump(unsigned char key)
+{
+ printk("ofdump:\n");
+ /* make sure the OF devtree is good */
+ ofd_walk((void *)oftree, "devtree", OFD_ROOT,
+ ofd_dump_props, OFD_DUMP_ALL);
+}
+
static void percpu_init_areas(void)
{
unsigned int i, data_size = __per_cpu_data_end - __per_cpu_start;
/* Register another key that will allow for the the Harware Probe
* to be contacted, this works with RiscWatch probes and should
* work with Chronos and FSPs */
- register_irq_keyhandler('^', hw_probe_attn, "Trap to Hardware Probe");
+ register_keyhandler('^', key_hw_probe_attn, "Trap to Hardware Probe");
+
+ /* allow the dumping of the devtree */
+ register_keyhandler('D', key_ofdump , "Dump OF Devtree");
timer_init();
serial_init_postirq();
memory_init(mod, mbi->mods_count);
#ifdef OF_DEBUG
- printk("ofdump:\n");
- /* make sure the OF devtree is good */
- ofd_walk((void *)oftree, OFD_ROOT, ofd_dump_props, OFD_DUMP_ALL);
+ key_ofdump(0);
#endif
percpu_init_areas();